const lovesmodle = require('../modle/lovesmodle');
const productmodle = require('../modle/products')
module.exports = {
    async getlovedata(data) {
        return await lovesmodle.findAll({
            where: {
                ...data
            }
        })
    },
    async findproduct(id, limit, offset) {
        return await productmodle.findAll({
            where: {
                id
            },
            limit: +limit,
            offset: (+offset - 1) * +limit,
            order: [
                ['createdAt', 'DESC']
            ]
        })
    },
    async setlovesdata(data) {
        return await lovesmodle.create({ ...data })
    },
    async dlelovesdata(data) {
        return await lovesmodle.destroy({
            where: {
                ...data
            }
        })
    }
}